package com.snk.back.controller;



import com.snk.back.service.SysCategoryService;
import com.snk.common.pojo.JsonResult;
import com.snk.pojo.SysCategory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/category/")
public class SysCategoryController {
	@Autowired
	private SysCategoryService sysCategoryService;
	@RequestMapping("doFindObjects")
	public JsonResult doFindObjects() {
		return new JsonResult(sysCategoryService.findObjects());
	}
	@RequestMapping("doFindZTreeNodes")
	public JsonResult doFindZTreeNodes() {
		return new JsonResult(sysCategoryService.findZTreeNodes());
	}
	
	@RequestMapping("doUpdateObject")
	public JsonResult doUpdateObject(SysCategory sysCategory){
		sysCategoryService.updateObject(sysCategory);
	    return new JsonResult("update ok");
	}
	
	@RequestMapping("doSaveObject")
	public JsonResult doSaveObject(SysCategory sysCategory){
		sysCategoryService.saveObject(sysCategory);
		return new JsonResult("save ok");
	}
	@RequestMapping("doDeleteObject")
	@ResponseBody
	public JsonResult doDeleteObject(Integer id){
		sysCategoryService.deleteObject(id);
		return new JsonResult("delete ok");
	}
}
